package com.webSite.demo.cy.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;

@Component
public class MyInterceptor implements HandlerInterceptor{

	
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
		// TODO Auto-generated method stub
		String name = ((HandlerMethod)handler).getBean().getClass().getName();
		System.out.println("进入的bean："+name);
		String methodName = ((HandlerMethod)handler).getMethod().getName();
		System.out.println("进入的method："+methodName);
		System.out.println("拦截器生效");
		return HandlerInterceptor.super.preHandle(request, response, handler);
	}
}
